<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:
        <input type="text" id="name" />
        <span></span>
    </div>
    <div>
        密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:
        <input type="text" id="password" />
    </div>
    <div>
        确认密码:
        <input type="password" />
    </div>
    <div>
        手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机:
        <input type="text" id="text" />
    </div>
    <div>
        <button type="button">提交</button>
    </div>
</body>
<script src="js/jquery-3.1.1.min (1).js"></script>
<script>
    $("#name").blur(function(){
        $.ajax({
            method:"get",
            url:"https://mock.apifox.cn/m1/2787410-0-default/lx",
            data:{name:$("#name").val()},
            dataType:"text",
            success:function(r){
                if(r=="has"){
                    $("#name+span").html("用户名重复").css({"color":"#f00"});
                }else{
                    $("#name+span").html("ok").css({"color":"#48b840"});
                }
            }
        })
       
    })
</script>
</html>